#define DEBUG2
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>

using namespace std;

int m, n;
int inside = 0;
bool isInter = false;

typedef struct TPoint {
	double x, y;
} TPoint;

typedef struct TShape {
	int num;
	TPoint* points;
} TShape;

vector<TPoint> shape;
TShape p1, p2;

TPoint operator - (TPoint a, TPoint b) {
	TPoint res;
	res.x = a.x - b.x;
	res.y = a.y - b.y;
	return res;
}
TPoint operator * (double s, TPoint x) {
	TPoint res;
	res.x = s*x.x;
	res.y = s*x.y;
	return res;
}

bool operator == (TPoint a, TPoint b) {
	return fabs(a.x-b.x) < 0.00001 && fabs(a.y-b.y) < 0.00001;
}

ostream& operator<<(std::ostream& os, const TPoint& a) {
	return cout << a.x << " " << a.y;
}

double norm(TPoint a) {return (a.x*a.x + a.y*a.y);}

double cross(TPoint a, TPoint b){
	return a.x*b.y - b.x*a.y;
}
double dot(TPoint a, TPoint b) {
	return a.x*b.x + a.y*b.y;
}

double calArea(TShape poly) {
	double area = 0;
	for (int i=0; i<poly.num; ++i)
		area += cross(poly.points[i+1], poly.points[i]);
	return area/2;
}

bool inShape(TPoint a, TShape s) {
	double deg = 0, tot = 0;
	TPoint u, v;
	for (int i=0; i<s.num; ++i) {
		u = s.points[i] - a;
		v = s.points[i+1] - a;
//		cout << u << " " << v << " " << cross(u, v) << " " << norm(u)*norm(v)<< endl;
		deg = asin(cross(u, v) / sqrt(norm(u)*norm(v)));
//		cout << "deg: " << deg << " " << (norm(s.points[i]-s.points[i+1]) > norm(u) + norm(v)) << endl;
		if (norm(s.points[i]-s.points[i+1]) > norm(u) + norm(v)) {
			if (deg < 0)
				deg = -M_PI - deg;
			else
				deg = M_PI - deg;
		}
		tot += deg;
//		cout << deg << endl;
	}
//	cout << tot << endl;
	return tot < -1;//deg = 0(out) or deg = -2PI(in)
}

//is s1 in s2?
bool inShape(TShape s1, TShape s2) {
	for (int i=0; i<s1.num; ++i)
		if (!inShape(s1.points[i], s2)) return false;
	return true;
}

TPoint getIntersection(TPoint a, TPoint b, TPoint u, TPoint v) {
	// 	cout << a << "  " << b << "  " << u << "  " << v << endl;
	TPoint ret;
	double t1, t2;

	t1 = fabs(cross(u-a, v-a));
	t2 = fabs(cross(u-b, v-b));

	if (t1+t2 < 0.00001) {
		t1 = dot(u-a, b-a);
		if (t1 > 0)
			ret = u;
		else
			ret = a;
	}
	else {
		ret.x = a.x+ t1/(t2+t1)*(b.x - a.x);
		ret.y = a.y+ t1/(t2+t1)*(b.y - a.y);
	}

	return ret;
}

bool touch(TPoint a, TPoint b, TPoint u, TPoint v) {
	double t;
	t = dot(a-u, b-u);
	if (t<0) return true;
	t = dot(a-v, b-v);
	if (t<0) return true;
	t = dot(u-a, v-a);
	if (t<0) return true;
	t = dot(u-b, v-b);
	if (t<0) return true;
	return false;
}

const int ONELINE = 4;
const int LEFTSIDE = 3;
const int RIGHTSIDE = 2;//inside direction for clockwise
const int CROSSSIDE = 1;//means point at
//x2-x1 at which side of b-a
int whichSide(TPoint a, TPoint b, TPoint x1, TPoint x2) {
	double t1, t2;
	t1 = cross(b-a, x1-a);
	t2 = cross(b-a, x2-a);
	int type = 0;
	const int X1RIGHT = 10;
	const int X1ON = 20;
	const int X1LEFT = 30;
	const int X2RIGHT = 1;
	const int X2ON = 2;
	const int X2LEFT = 3;

	// x1 right, x1 on, x1 left, x2 right, x2 on, x2 left
	// 32, 16, 8, 4, 2, 1
	// 10, 20, 30, 1, 2, 3
	if (fabs(t1) < 0.0001) type = X1ON;
	else if (t1 > 0) type = X1LEFT;
	else type = X1RIGHT;

	if (fabs(t2) < 0.0001) type += X2ON;
	else if (t2 > 0) type += X2LEFT;
	else type += X2RIGHT;

	int side = -1;
	if (type == X1LEFT+X2LEFT) {
		side = LEFTSIDE; //both left [3 3]
	}
	else if (type==X1ON+X2ON && !touch(a,b,x1,x2)) {
		side = ONELINE;
	}
	else if (type == X1RIGHT+X2RIGHT) {
		side = RIGHTSIDE; //both right [1 1]
	}
	else {
		side = CROSSSIDE; //cross, [1 3], [3 1], 
	}

	return side;
}

bool checkPointAt(TPoint a, TPoint b, TPoint u, TPoint v) {
	double t1, t2;
	t1 = fabs(cross(b-u, a-u));
	t2 = fabs(cross(b-v, a-v));
	if (fabs(t1) < 0.00001 && fabs(t2) < 0.00001) {
		t1 = dot(u-v, a-v);
		return (t1 < 0);
	}
	return (t2 < t1);
}

const int P1 = 0;
const int P2 = 1;

int forward(TPoint a, TPoint b, TPoint u, TPoint v) {
	int sideType1 = whichSide(a, b, u, v);
	int sideType2 = whichSide(u, v, a, b);

	bool pointAt1 = false;
	bool pointAt2 = false;

	if (sideType1 != CROSSSIDE)
		pointAt1 = checkPointAt(a,b,u,v);
	if (sideType2 != CROSSSIDE)
		pointAt2 = checkPointAt(u,v,a,b);

	//b-a point at v-u, move on b-a
	if (!pointAt1 && pointAt2) {
		return P1;
	}
	if (pointAt1 && !pointAt2) {
		return P2;
	}

	//b-a is outside, point at each other
	if (pointAt1 && pointAt2) {
		if (sideType2 == LEFTSIDE) {
		//sideType1 should be RIGHTSIDE
			return P1;
		}
		else if (sideType2 == RIGHTSIDE) {
		//sideType1 should be LEFTSIDE
			return P2;
		}
	}

	if (sideType1 == CROSSSIDE && sideType2 == CROSSSIDE) {
		isInter = true;
		double t = cross(b-a, v-a);
		if (fabs(t) < 0.00001) {
			t = cross(u-a, b-a);
			if (fabs(t) < 0.00001)
				t = dot(u-b, v-b);
		}

		if (t < 0) {
			inside = 2;
			return P1;
		}
		else {
			inside = 1;
			return P2;
		}
	}

	//none point at others
	if (!pointAt1 && !pointAt2) {
		double t = cross(b-a, v-a);
		//v-u just go outside
		if (t >= 0) {
			return P2;
		}
		else {
			return P1;
		}
	}

	return -1;
}

TShape calOverlap(TShape p1, TShape p2) {
	int iter1 = 0;
	int iter2 = 0;
	int **appearTimes;
	appearTimes = new int*[p1.num];
	for (int i=0; i<p1.num; ++i) {
		appearTimes[i] = new int[p2.num];
		for (int j=0; j<p2.num; ++j)
			appearTimes[i][j] = 0;
	}

	while (true) {
		++appearTimes[iter1][iter2];
//    		cout << "iter1: " << iter1 << "   " << "iter2: " << iter2 << endl;
		if (appearTimes[iter1][iter2] >= 3) break;
		isInter = false;
		int which = forward(p1.points[iter1], p1.points[iter1+1],
				p2.points[iter2], p2.points[iter2+1]);

		if (isInter) {
			TPoint intersect = getIntersection(p1.points[iter1], p1.points[iter1+1],
				p2.points[iter2], p2.points[iter2+1]);
			bool pushIt = true;
			if (which == P1) {
				if (intersect == p1.points[iter1])
					pushIt = false;
			}
			else {
				if (intersect == p2.points[iter2])
					pushIt = false;
			}
			if (pushIt) {
				shape.push_back(intersect);
			}
		}
		
		if (which == P1) {
			if (inside == 1) {
				shape.push_back(p1.points[iter1+1]);
			}
			iter1 = (iter1+1) % p1.num;
		}
		else if (which == P2) {
			if (inside == 2) {
				shape.push_back(p2.points[iter2+1]);
			}
			iter2 = (iter2+1) % p2.num;
		}
	}

	vector<TPoint>::iterator vIter;
	vIter = unique(shape.begin(), shape.end());
	shape.resize(vIter - shape.begin());
	
	if (shape.size() > 2)
		for (int i=1; i<shape.size(); ++i)
			if (shape[i] == shape[0]) {
				shape.resize(i+1);
				break;
			}

	TShape newShape;
	newShape.num = shape.size();
	newShape.points = new TPoint[newShape.num];
	for (int i=0; i<newShape.num; ++i)
		newShape.points[i] = shape[i];
	if (newShape.num>0)
		--newShape.num;
	else {
		if (inShape(p1, p2))
			return p1;
		else if (inShape(p2, p1))
			return p2;
	}
	return newShape;
}

int main(void)
{
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
	p1.num = p2.num = 0;
	p1.points = p2.points = 0;
	int dataNum = 0;
	while (true){
//		cout << dataNum++ << endl;
		cin >> m;
		if (m == 0) break;
		p1.num = m;
		p1.points = new TPoint[m+1];
		for (int i=0; i<m; ++i)
			cin >> p1.points[i].x >> p1.points[i].y;
		p1.points[m] = p1.points[0];
		cin >> n;
		p2.num = n;
		p2.points = new TPoint[n+1];
		for (int i=0; i<n; ++i)
			cin >> p2.points[i].x >> p2.points[i].y;
		p2.points[n] = p2.points[0];
#ifdef DEBUG
		cout << "p1 area: " << calArea(p1) << endl;
		cout << "p2 area: " << calArea(p2) << endl;
#endif
		TShape itsctShape = calOverlap(p1, p2);
#ifdef DEBUG
		cout << itsctShape.num << endl;
		for (int i=0; i<itsctShape.num; ++i)
			cout << itsctShape.points[i] << endl;
#endif
		double itsctShapeArea = calArea(itsctShape);
		double intersectArea = calArea(p1) + calArea(p2) - itsctShapeArea;
#ifdef DEBUG
		cout << "itesct shape area: " << itsctShapeArea << endl
			<< "iter area: " << intersectArea << endl;
#endif
		cout << setprecision(2) << setiosflags(ios::fixed) << setw(8)
			<< intersectArea - itsctShapeArea;

		delete[] p1.points;
		delete[] p2.points;
		p1.num = p2.num = 0;
		p1.points = p2.points = 0;
		shape.clear();
		isInter = false;
		inside = 0;
	}
	cout << endl;
// 	fclose(stdout);
	return 0;
}
